# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-dask
pkgver=2023.12.0
pkgrel=0
pkgdesc="Parallel computing with task scheduling"
url="https://dask.org/"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-click
	py3-cloudpickle
	py3-fsspec
	py3-importlib-metadata
	py3-numpy
	py3-packaging
	py3-pandas
	py3-partd
	py3-toolz
	py3-yaml
	"
makedepends="
	py3-gpep517
	py3-python-versioneer
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-flaky
	py3-graphviz
	py3-jinja2
	py3-pandas-tests
	py3-pytest
	py3-pytest-cov
	py3-pytest-runner
	py3-pytest-xdist
	py3-scipy
	"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/d/dask/dask-$pkgver.tar.gz
	no-warn.patch
	"
builddir="$srcdir/dask-$pkgver"

case "$CARCH" in
x86|arm*)
# x86: assert sizeof(sp.todok()) >= 192
# arm*: fails a bunch of tests
options="!check"
;;
esac

# secfixes:
#   2022.2.0-r0:
#     - CVE-2021-42343

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# dataframe ones fail due to deprecation warnings
	# matches_ci fails on a missing workflow yaml file
	# test_csv and test_with_spec_integer_method fail on s390x
	# test_dataframe_aggregations_multilevel: _FlakyPlugin._make_test_flaky() got an unexpected keyword argument 'reruns'
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n ${JOBS:-2} \
		--ignore=dask/dataframe/tests/test_dataframe.py \
		--ignore=dask/dataframe/io/tests/test_csv.py \
		-k 'not test_development_guidelines_matches_ci and not test_dataframe_aggregations_multilevel and not test_RandomState_only_funcs and not test_solve_assume_a[20-10] and not test_solve_assume_a[30-6] and not test_with_spec_integer_method'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python*/site-packages/dask/tests
	rm -r "$pkgdir"/usr/lib/python*/site-packages/dask/*/tests
}

sha512sums="
b4e81f7e0ff23862824b71c98f36293da2d11bc49b5f82df556be0023d001aa85181db336e8333bb4c589259d18435ef04289219706479e3982b2c2bb398e7c6  dask-2023.12.0.tar.gz
4c75e0247b5e0a6f2cf6a4533c1efbadf2a095618cc32aec33692e82acd1a79c48f2c6ae3dd55549560965abb0df365f25ab38f0e902b05c79964a0698121ea1  no-warn.patch
"
